﻿#region
/* ===============================================
 * 作者：guopeng           时间：2012/2/2 23:17:17
 * 
 * 
 * 类描述：
 * 
 * 
 * =============================================== */
#endregion

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Linq.Expressions;

namespace GoodMan.Infrastructure.Entities
{
    public class ModityContext<T>
    {
        protected string tableName { get; set; }
        
        /// <summary>
        /// where 字句
        /// </summary>
        internal string wheresentence = string.Empty;

        protected string BuildValue(object value)
        {
            return (value.GetType() != typeof(int) ?
                    value.GetType() == typeof(bool) ? Convert.ToBoolean(value) ? "1" : "0" :
                    String.Format("'{0}'", value) :
                    value).ToString();
        }

        public WhereOption<T> WhereSet<TKey>(Expression<Func<T, TKey>> expression, WhereOperator option, object value)
        {
            return new WhereOption<T>(this).WhereSet<TKey>(expression, option, value);
        }
        public WhereOption<T> WhereIn<TKey, TParm>(Expression<Func<T, TKey>> expression, List<TParm> value)
        {
            return new WhereOption<T>(this).WhereIn<TKey,TParm>(expression, value);
        }
        public virtual int Excute()
        {
            return 0;
        }
    }
}
